import request from '@/utils/request'

// 获取批量修改商品任务列表
export function paging(query) {
  return request({
    url: '/goods/projectGoodsBatchModifyTask/paging',
    method: 'get',
    params: query
  })
}

// 统计状态数量：批量修改商品任务
export function statisticsStatusNum(query) {
  return request({
    url: '/goods/projectGoodsBatchModifyTask/statisticsStatusNum',
    method: 'get',
    params: query
  })
}

// 保存批量修改商品任务
export function saveProjectGoodsBatchModifyTask(data) {
  return request({
    url: '/goods/projectGoodsBatchModifyTask/save',
    method: 'post',
    data: data
  })
}

// 删除批量修改商品任务
export function deleteProjectGoodsBatchModifyTask(taskId) {
  if (!taskId) {
    return false
  }
  return request({
    url: '/goods/projectGoodsBatchModifyTask/delete',
    method: 'post',
    params: {
      taskId: taskId
    }
  })
}
// 修改商品批量修改任务状态
export function updateTaskStatus(taskId, status) {
  if (!taskId) {
    return false
  }
  if (!status) {
    return false
  }
  return request({
    url: '/goods/projectGoodsBatchModifyTask/updateTaskStatus',
    method: 'post',
    params: {
      taskId: taskId,
      status: status
    }
  })
}

// 获取批量修改商品任务详情
export function getProjectGoodsBatchModifyTaskDetail(enterpriseId, supplierId, memberId, taskId, modifyType) {
  if (enterpriseId === undefined) {
    return
  }
  if (taskId === undefined) {
    return
  }
  if (modifyType === undefined) {
    return
  }
  var query = {
    enterpriseId: enterpriseId,
    supplierId: supplierId,
    memberId: memberId,
    taskId: taskId,
    modifyType: modifyType
  }
  return request({
    url: '/goods/projectGoodsBatchModifyTask/getProjectGoodsBatchModifyTaskDetail',
    method: 'get',
    params: query
  })
}
// 获取修改字段类型列表，从枚举获取的
export function getModifyFieldTypeList(enterpriseId, supplierId, memberId) {
  var query = {
    enterpriseId: enterpriseId,
    supplierId: supplierId,
    memberId: memberId
  }
  return request({
    url: '/goods/projectGoodsBatchModifyTask/getModifyFieldTypeList',
    method: 'get',
    params: query
  })
}
// 导出批量修改
// exportType：导出类型，0-全部，1-成功，2-失败
export function exportModifyTaskRecord(taskId, exportType) {
  return request({
    url: '/goods/projectGoodsBatchModifyTask/doExportModifyTaskRecord',
    method: 'post',
    params: {
      taskId: taskId,
      exportType: exportType
    }
  })
}
